<?xml version="1.0" encoding="utf-8"?>
<!--
                                                                                     
 h       t     t                ::       /     /                     t             / 
 h       t     t                ::      //    //                     t            // 
 h     ttttt ttttt ppppp sssss         //    //  y   y       sssss ttttt         //  
 hhhh    t     t   p   p s            //    //   y   y       s       t          //   
 h  hh   t     t   ppppp sssss       //    //    yyyyy       sssss   t         //    
 h   h   t     t   p         s  ::   /     /         y  ..       s   t    ..   /     
 h   h   t     t   p     sssss  ::   /     /     yyyyy  ..   sssss   t    ..   /     
                                                                                     
	<https://y.st./>
	Copyright © 2017 Alex Yst <mailto:copyright@y.st>

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program. If not, see <https://www.gnu.org./licenses/>.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="https://y.st./en/opinion/code_indentation.xhtml"/>
		<title>Code indentation &lt;https://y.st./en/opinion/code_indentation.xhtml&gt;</title>
		<link rel="icon" type="image/png" href="/link/CC_BY-SA_4.0/y.st./icon.png"/>
		<link rel="stylesheet" type="text/css" href="/link/main.css"/>
		<script type="text/javascript" src="/script/javascript.js"/>
		<meta name="viewport" content="width=device-width"/>
	</head>
	<body>
<nav>
	<p>
		<a href="/en/coursework/">Coursework</a> |
		<a href="/en/take-down/">Take-down requests</a> |
		<a href="/en/">Home</a> |
		<a href="/en/a/about.xhtml">About</a> |
		<a href="/en/a/contact.xhtml">Contact</a> |
		<a href="/a/canary.txt">Canary</a> |
		<a href="/en/URI_research/"><abbr title="Uniform Resource Identifier">URI</abbr> research</a> |
		<a href="/en/opinion/">Opinions</a> |
		<a href="/en/law/">Law</a> |
		<a href="/en/recipe/">Recipes</a> |
		<a href="/en/a/links.xhtml">Links</a> |
		<a href="/en/opinion/code_indentation.xhtml.asc">{this page}.asc</a>
	</p>
	<hr/>
	<p>
		<a href="/en/opinion/XML.xhtml"><abbr title="Extensible Markup Language">XML</abbr></a> |
		<a href="/en/opinion/code_indentation.xhtml">Code indentation</a> |
		<a href="/en/opinion/free_culture.xhtml">Free culture</a> |
		<a href="/en/opinion/free_software.xhtml">Free software</a> |
		<a href="/en/opinion/holidays.xhtml">Holidays</a> |
		<a href="/en/opinion/misuse_of_words.xhtml">Misuse of words</a>
	</p>
	<hr/>
</nav>
		<header>
			<h1>Code indentation</h1>
			<p>The old tabs versus spaces argument</p>
		</header>
<p>Honestly, how you choose to indent your code is up to you. Some people use tabs, some people use spaces, and either option if fine. However, it drives me bonkers when people argue that everyone needs to indent using spaces. Really? Spaces are a horrible way to indent compared to tabs.</p>
<h2>Tabs are a single character</h2>
<p>When arguing that people need to use spaces to indent, it&apos;s often said that a <strong>*certain number*</strong> of spaces should be used. Uniformity is important, after all. But what could be more uniform than indenting using tab characters? With spaces, not only do you need to decide to use spaces instead of tabs, you need to decide how many spaces to use. With tabs, it&apos;s easy. No one indents using multiple tab characters because a tab character already takes up as much space as you tell your editor to make it take up.</p>
<h2>What is the tab character even for?</h2>
<p>Spaces are word separators. They&apos;re not meant for indentation. Do you know what character <strong>*is*</strong> meant for indentation? It&apos;s the tab character! Why not use the tab character for what it&apos;s meant for instead of ignoring it altogether?</p>
<p>Spaces make it easier to line things up. When trying to line up variable names in code or when trying to put Unicode art in your source code comments, spaces are great. However, tab characters have a semantic meaning. When indenting code, tabs are the way to go.</p>
<h2>Conclusions</h2>
<p>I don&apos;t care how you want to indent your code. However, please stop lecturing me about why I need to use spaces instead of tabs. You&apos;re wrong. If I&apos;m not in your employ and not making pull requests to your code, I&apos;ll indent however I please. And how I please is the only way that makes sense to me: using tab characters.</p>
		<hr/>
		<p>
			Copyright © 2017 Alex Yst;
			You may modify and/or redistribute this document under the terms of the <a rel="license" href="/license/gpl-3.0-standalone.xhtml"><abbr title="GNU&apos;s Not Unix">GNU</abbr> <abbr title="General Public License version Three or later">GPLv3+</abbr></a>.
			If for some reason you would prefer to modify and/or distribute this document under other free copyleft terms, please ask me via email.
			My address is in the source comments near the top of this document.
			This license also applies to embedded content such as images.
			For more information on that, see <a href="/en/a/licensing.xhtml">licensing</a>.
		</p>
		<p>
			<abbr title="World Wide Web Consortium">W3C</abbr> standards are important.
			This document conforms to the <a href="https://validator.w3.org./nu/?doc=https%3A%2F%2Fy.st.%2Fen%2Fopinion%2Fcode_indentation.xhtml"><abbr title="Extensible Hypertext Markup Language">XHTML</abbr> 5.2</a> specification and uses style sheets that conform to the <a href="http://jigsaw.w3.org./css-validator/validator?uri=https%3A%2F%2Fy.st.%2Fen%2Fopinion%2Fcode_indentation.xhtml"><abbr title="Cascading Style Sheets">CSS</abbr>3</a> specification.
		</p>
	</body>
</html>

